<?php

/**
 * ECSHOP 鍓嶅彴鍏?敤鏂囦欢
 * ============================================================================
 * 鐗堟潈鎵€鏈 (C) 2005-2007 搴风洓鍒涙兂锛堝寳浜?級绉戞妧鏈夐檺鍏?徃锛屽苟淇濈暀鎵€鏈夋潈鍒┿€
 * 缃戠珯鍦板潃: http://www.ecshop.com
 * ----------------------------------------------------------------------------
 * 杩欐槸涓€涓?厤璐瑰紑婧愮殑杞?欢锛涜繖鎰忓懗鐫€鎮ㄥ彲浠ュ湪涓嶇敤浜庡晢涓氱洰鐨勭殑鍓嶆彁涓嬪?绋嬪簭浠ｇ爜
 * 杩涜?淇?敼銆佷娇鐢ㄥ拰鍐嶅彂甯冦€
 * ============================================================================
 * $Author: dolphin $
 * $Date: 2008-10-09 17:56:28 +0800 (鏄熸湡鍥? 2008-10-09) $
 * $Id: init.php 14938 2008-10-09 09:56:28Z dolphin $
*/

error_reporting(7);

if (!defined('IN_ECS'))
{
    die('Hacking attempt');
}

/* 鍙栧緱褰撳墠client鎵€鍦ㄧ殑鏍圭洰褰 */
define('CLIENT_PATH', substr(__FILE__, 0, -17));

/* 璁剧疆maifou.net鎵€鍦ㄧ殑鏍圭洰褰 */
define('ROOT_PATH', substr(__FILE__, 0, -28));

$php_self = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
if ('/' == substr($php_self, -1))
{
    $php_self .= 'index.php';
}
define('PHP_SELF', $php_self);

// 閫氱敤鍖呭惈鏂囦欢
require(ROOT_PATH . 'data/config.php');
require(ROOT_PATH . 'includes/lib_common.php');
require(ROOT_PATH . 'includes/cls_mysql.php');
/* 鍏煎?ECShopV2.5.1鐗堟湰杞藉叆搴撴枃浠 */
if (!function_exists('addslashes_deep'))
{
    require(ROOT_PATH . 'includes/lib_base.php');
}
require(CLIENT_PATH . 'includes/lib_api.php');    // API搴撴枃浠
require(CLIENT_PATH . 'includes/lib_struct.php'); // 缁撴瀯搴撴枃浠

// json绫绘枃浠
require(ROOT_PATH . 'includes/cls_json.php');

/* 瀵圭敤鎴蜂紶鍏ョ殑鍙橀噺杩涜?杞?箟鎿嶄綔銆?/
if (!get_magic_quotes_gpc())
{
    $_COOKIE   = addslashes_deep($_COOKIE);
}

/* 鍏煎?ECShopV2.5.1鐗堟湰 */
if (!defined('EC_CHARSET'))
{
    define('EC_CHARSET', 'utf-8');
}

/* 鍒濆?鍖朖SON瀵硅薄 */
$json = new JSON;

/* 鍒嗘瀽JSON鏁版嵁 */
parse_json($json, $_POST['Json']);

/* 鍒濆?鍖栧寘鍚?枃浠 */
require(ROOT_PATH . 'includes/inc_constant.php');
require(ROOT_PATH . 'includes/cls_ecshop.php');
require(ROOT_PATH . 'includes/lib_time.php');
require(ROOT_PATH . 'includes/lib_main.php');
require(ROOT_PATH . 'includes/lib_insert.php');
require(ROOT_PATH . 'includes/lib_goods.php');

/* 鍒涘缓 ECSHOP 瀵硅薄 */
$ecs = new ECS($db_name, $prefix);

/* 鍒濆?鍖栨暟鎹?簱绫 */
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'), $ecs->table('cart')));
$db_host = $db_user = $db_pass = $db_name = NULL;

/* 杞藉叆绯荤粺鍙傛暟 */
$_CFG = load_config();

/* 杞藉叆璇?█鍖 */
require(ROOT_PATH.'languages/' .$_CFG['lang']. '/admin/common.php');
require(ROOT_PATH.'languages/' .$_CFG['lang']. '/admin/log_action.php');

/* 鍒濆?鍖杝ession */
include(ROOT_PATH . 'includes/cls_session.php');

$sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'), 'CL_ECSCP_ID');

define('SESS_ID', $sess->get_session_id());

/* 鍒ゆ柇鏄?惁鐧诲綍浜 */
if ((!isset($_SESSION['admin_id']) || intval($_SESSION['admin_id']) <= 0) && ($_POST['Action'] != 'UserLogin'))
{
    client_show_message(110);
}

if ($_CFG['shop_closed'] == 1)
{
    /* 鍟嗗簵鍏抽棴浜嗭紝杈撳嚭鍏抽棴鐨勬秷鎭 */
    client_show_message(105);
}

?>